package com.Day04;

public class Bank{
    public String name;
    private int num;

    public void setNum(int num) {
        if(num <= 0) {
            System.out.println("你输入数字有误，请重新输入");
            return;
        }
        this.num = num;
    }
    public int getNum(){
        return this.num;
    }

    public void withdraw(int money){
        if(money > num){
            System.out.println("你的账户余额小于你要取出的金钱");
            return;
        }
        if(num <= 0){
            System.out.println("余额已经小于0了");
            return;
        }

        setNum(getNum() - money);
        System.out.println(money + "元取款成功");
    }
}
